@extends('layouts.back_stage')
@section('content')
  <style>
  /* .container{background:#fff;margin-top:30px} */
  #app{padding:20px}
  .getadd{display:inline-block;background:#409eff;height:30px;width:50px;
    text-align:center;line-height:35px;color:#fff;font-size:16px;margin-left:20px;
    border-radius:8%}
  .right-f{float:right;} 
  .ingred_sel{width:200px;margin:0 30px 0 10px} 
  .type_x{margin:40px 20px 5px 10px } 
  .table_margin{padding:10px;background:#fff;text-align:content;margin-top:10px}
  table{text-align:content}
  .pation{text-align:center}
  .updata{font-size:10px;color:#409eff}
  .add_look{width:250px; margin:0 30px 0 10px}
  .look_margin{margin:10px 0}
  .look_width{width:250px;}
  .look_tab{width:80px;}
  .span{border:1px solid #dadde3;background:#f5f7fa;display:inline-block;width:180px;height:30px;line-height:30px;padding-left:5px;color:#dadde3}
  .tab_width{width:110px}
  .caser{width:250px}
  </style>
  <div class="container">
        <div class="page-body" id="app">
              <div class="type_x">
                <!-- <label>所属机构</label>
                  <el-autocomplete
                      class="ingred_sel"
                      v-model="state"
                      size="small"
                      :fetch-suggestions="querySearch"
                      placeholder="请输入内容"
                      :trigger-on-focus="false"
                      @select="handleSelect"
                      ></el-autocomplete> -->
                      <label>名称</label>
                          <el-input  class="ingred_sel"  id="namex"  size="small" placeholder="请输入名称"></el-input>
                      <label>手机号</label>
                         <el-input  class="ingred_sel on" id="telx"  size="small" placeholder="请输入完整手机号码"></el-input>
                         <el-button  class="but-left" @click="onGet" size="small" type="primary">查询 </el-button>
                      <span class="right-f">
                            <el-button type="primary"  size="small" @click="added">添加</el-button>
                            <el-button type="primary"  size="small" @click="audit">审核</el-button>        
                            <el-button type="primary"  size="small" @click="reverify">反审</el-button>
                            <el-button type="primary"  size="small" @click="expost">导出</el-button>
                      </span>
                 </div>
           <div class="table_margin">
                <el-table :data="tableData" border size="small" @select="check" style="width: 100%" @filter-change="filterTag"  @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="50"></el-table-column>
                    <el-table-column prop="loop" label="序号"  width="50"> </el-table-column>
                     <el-table-column  prop="jigou" label="所属机构" width="150"></el-table-column>
                     <el-table-column prop="type"    label="类型" width="100" column-key="type"
                      :filters="[{ text: '分公司', value: '1' }, { text: '代理商', value: '2' }]"
                     >
                    <template slot-scope="scope">
                        <span v-if="scope.row.type===1">分公司</span>
                        <span v-if="scope.row.type===2">代理商</span>  
                    </template>
                    </el-table-column>
                    <el-table-column
                      prop="name"
                      label="名称"
                      width="180"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="tel"
                      label="手机号"
                      width="150">
                    </el-table-column>
                  
                    <el-table-column
                      prop="supervisor"
                      label="审核人"
                      width="120">
                    </el-table-column>
                    <el-table-column
                      prop="verified_at"
                      label="审核时间"
                      width="180"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="admin_a"
                      label="录入人"
                      width="120">
                    </el-table-column>
                    <el-table-column
                        prop="created_at"
                        label="录入时间"
                        width="180"
                      >
                    </el-table-column>
                    <el-table-column
                      prop="status"
                      label="状态"
                      width="130"
                      column-key="type"
                      :filters="[{ text: '启用未审核', value: '1' }, { text: '启用已审核', value: '2' },{text: '停用未审核', value: '11'},{text: '停用已审核', value: '12'}]"
                      >
                    <template slot-scope="scope">
                        <span v-if="scope.row.status===1">启用未审核</span>
                        <span v-if="scope.row.status===2">启用已审核</span>
                        <span v-if="scope.row.status===11">停用未审核</span>
                        <span v-if="scope.row.status===12">停用已审核</span>
                      </template>
                    </el-table-column>
     
                    <el-table-column
                      fixed="right"
                      label="操作"
                      width="120"
                      >
                    <template slot-scope="scope" > 
                        <template>
                            <a v-if="scope.row.status===11 ||scope.row.status===12"  class="updata" @click="deleteRow($event)">使用</a>
                            <a v-if="scope.row.status===1 || scope.row.status===2" class="updata" @click="deleteRow($event)">停用</a>
                        </template>
                          <a  class="updata" @click="updataDis(scope)">修改</a > 
                          <a  class="updata"  @click="lookDis(scope)">查看</a >
                    </template>
                    </el-table-column>
                </el-table>              
             </div>
             <div class="pation">
               <el-pagination
                  background
                  :page-size="10"
                  @current-change="handleCurrentChange"
                  layout="prev, pager, next"
                  :total="total">
                </el-pagination>
           </div>
           <el-dialog
                    title="查看客户基本信息"
                    :visible.sync="dialogVisible"
                    width="70%" 
                    :before-close="handleClose">
                    <el-form ref="form" :model="formDalog" disabled label-width="80px" size="mini">
                      <div class="look_margin">
                      <label>所属机构 &nbsp;&nbsp;</label>
                            <!-- <select class="ingred_sel two" v-model="formDalog.pid" name="supplier">
                              <option value="">请选择</option>  
                              <option value="11">大品文化</option>                                      
                              <option value="22">杭州分公司</option>
                              <option value="33">河南分公司</option>                                                                           
                            </select> -->

                            <el-select v-model="aelect_pid"  disabled size="small" >
                              <el-option v-for="item in data_x"  disabled :key="item.id" :label="item.pid" :value="item.pid"></el-option>
                            </el-select>
                          <label> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类型&nbsp;&nbsp;&nbsp;&nbsp;</label>
                              <!-- <select class="ingred_sel one"  v-model="formDalog.type" name="supplier">
                                  <option value="">请选择</option>  
                                  <option value="1">代理商</option>                                      
                                  <option value="2">分公司</option>
                                  <option value="3">客户</option>                                                                          
                                </select> -->

                             <el-select v-model="aelect_type" disabled size="small" >
                              <el-option v-for="item in data_x" disabled  :key="item.id" :label="item.type" :value="item.type"></el-option>
                            </el-select>
                       <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名称:</label>
                          <el-input  class="ingred_sel"  disabled v-model="formDalog.name" size="small"></el-input>
                       
                        </div>
                        <div class="look_margin"> 
                            <label>&nbsp;&nbsp;&nbsp;手机号:</label>
                              

                              <el-input  class="ingred_sel" disabled v-model="formDalog.tel" size="small"></el-input>
                            <label> &nbsp;&nbsp;当前状态:</label>                         
                                  <span class="span" v-if="formDalog.status===1">启用未审核</span>
                                  <span class="span" v-if="formDalog.status===2">启用已审核</span>
                                  <span class="span" v-if="formDalog.status===11">停用未审核</span>
                                  <span class="span" v-if="formDalog.status===12">停用已审核</span>      
                       </div>

                      <div class="look_margin" >
                          <label> &nbsp;&nbsp;&nbsp;省市区:&nbsp;&nbsp;</label>
                            <!-- <el-input  class="add_look"  v-model="formDalog.area_bh" size="small" ></el-input> -->
                            <el-cascader
                                :options="options"
                                size="small"
                                class='caser'
                                disabled
                                :placeholder="pleader"
                                v-model="area"
                                @focus="handleChange">
                              </el-cascader>
                          
                         
                          <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;详细地址:</label>
                            <el-input  class="add_look"  disabled v-model="formDalog.address" size="small"></el-input>
                         </div>  

                        <!-- <div class="look_margin" >
                          <label> &nbsp;&nbsp;&nbsp;录入人:</label>
                              <el-input  class="ingred_sel" v-model="formDalog.loguser" size="small"></el-input>
                          <label> &nbsp;&nbsp;录入时间:</label>
                            <el-input  class="look_width" v-model="formDalog.created_at" size="small"></el-input>
                       </div> 
                       <div class="look_margin" >
                          <label> &nbsp;&nbsp;&nbsp;审核人:</label>
                              <el-input  class="ingred_sel" v-model="formDalog.supervisor" size="small"></el-input>
                          <label> &nbsp;&nbsp;审核时间:</label>
                            <el-input  class="look_width" v-model="formDalog.verified_at" size="small"></el-input>
                       </div>  -->
                       <div class="look_margin" >
                          <label>默认折扣:</label>
                              <el-input  class="ingred_sel" disabled  v-model="formDalog.discount_default" size="small"></el-input>
                         <label> &nbsp;&nbsp;&nbsp;实际折扣:</label>
                              <el-input  class="ingred_sel"   disabled v-model="formDalog.policy_discount" size="small"></el-input>
                       </div> 
                       <div class="look_margin">
                         <h3>&nbsp; 退货率</h3>
                         <div class="look_margin" >
                            <label>&nbsp;&nbsp;第一季度:</label>
                              <el-input  class="look_tab" disabled v-model="formDalog.first_rate" size="small" ></el-input>
                              <el-date-picker
                               
                                v-model="formDalog.first_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                disabled
                                :start-placeholder="formDalog.spring_start"
                                :end-placeholder="formDalog.spring_end"
                                >
                              </el-date-picker>
                              </div> 
                            <label>&nbsp;&nbsp;第二季度:</label>
                              <el-input  class="look_tab" disabled v-model="formDalog.second_rate" size="small"></el-input>
                              <el-date-picker
                                v-model="formDalog.second_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                disabled
                                :start-placeholder="formDalog.summer_start"
                                :end-placeholder="formDalog.summer_end"
                               
                               >
                              </el-date-picker>
                             
                              </div> 
                       <div class="look_margin">
                             <label>&nbsp;&nbsp;第三季度:</label>
                                  <el-input  class="look_tab"  disabled v-model="formDalog.third_rate"  size="small" ></el-input>
                               <el-date-picker
                                v-model="formDalog.third_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                disabled
                                :start-placeholder="formDalog.fall_start"
                                :end-placeholder="formDalog.fall_end"
                               
                               >
                              </el-date-picker>
                             
                              </div>     
                              <div class="look_margin">
                              <label>&nbsp;&nbsp;第四季度:</label>
                                <el-input  class="look_tab" disabled  v-model="formDalog.fourth_rate" size="small"></el-input>
                                <el-date-picker
                                  v-model="formDalog.fourth_daterange"
                                  value-format="yyyy-MM-dd"
                                  type="daterange"
                                  size="small"
                                  disabled
                                  :start-placeholder="formDalog.winter_start"
                                  :end-placeholder="formDalog.winter_end"
                                 
                                  >
                                </el-date-picker>

                              </div> 
                       <div class="look_margin">
                             <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;全年:</label>
                                  <el-input  class="look_tab" disabled  v-model="formDalog.year_rate"  size="small" ></el-input> 
                           <el-date-picker
                                v-model="formDalog.year_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                disabled
                                :start-placeholder="formDalog.year_start"
                                :end-placeholder="formDalog.year_end"
                               
                                >
                              </el-date-picker>
                           </div>
                            
                          <!-- <el-form-item>
                            <el-button type="primary" @click="UpdataSubmit">确认修改</el-button>
                            <el-button>取消</el-button>
                          </el-form-item> -->
                  </el-dialog>

                    <el-dialog
                    title="修改客户基本信息"
                    :visible.sync="UpdataForm"
                    width="70%" 
                    :before-close="handleClose">
                    <el-form ref="form" :model="formDalog" label-width="80px" size="mini">
                      <div class="look_margin">
                      <label>所属机构 &nbsp;&nbsp;</label>
                            <!-- <select class="ingred_sel two" v-model="formDalog.pid" name="supplier">
                              <option value="">请选择</option>  
                              <option value="11">大品文化</option>                                      
                              <option value="22">杭州分公司</option>
                              <option value="33">河南分公司</option>                                                                           
                            </select> -->

                            <el-select v-model="aelect_pid"  size="small" >
                              <el-option v-for="item in data_x" :key="item.id" :label="item.pid" :value="item.pid"></el-option>
                            </el-select>
                          <label> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类型&nbsp;&nbsp;&nbsp;&nbsp;</label>
                              <!-- <select class="ingred_sel one"  v-model="formDalog.type" name="supplier">
                                  <option value="">请选择</option>  
                                  <option value="1">代理商</option>                                      
                                  <option value="2">分公司</option>
                                  <option value="3">客户</option>                                                                          
                                </select> -->

                             <el-select v-model="aelect_type"  size="small" >
                              <el-option v-for="item in data_x" :key="item.id" :label="item.type" :value="item.type"></el-option>
                            </el-select>
                       <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名称:</label>
                          <el-input  class="ingred_sel" v-model="formDalog.name" size="small"></el-input>
                       
                        </div>
                        <div class="look_margin"> 
                            <label>&nbsp;&nbsp;&nbsp;手机号:</label>
                              

                              <el-input  class="ingred_sel"  v-model="formDalog.tel" size="small"></el-input>
                            <label> &nbsp;&nbsp;当前状态:</label>                         
                                  <span class="span" v-if="formDalog.status===1">启用未审核</span>
                                  <span class="span" v-if="formDalog.status===2">启用已审核</span>
                                  <span class="span" v-if="formDalog.status===11">停用未审核</span>
                                  <span class="span" v-if="formDalog.status===12">停用已审核</span>      
                       </div>

                      <div class="look_margin" >
                          <label> &nbsp;&nbsp;&nbsp;省市区:&nbsp;&nbsp;</label>
                            <!-- <el-input  class="add_look"  v-model="formDalog.area_bh" size="small" ></el-input> -->
                            <el-cascader
                                :options="options"
                                size="small"
                                class='caser'
                                :placeholder="pleader"
                                v-model="area"
                                @focus="handleChange">
                              </el-cascader>
                          
                         
                          <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;详细地址:</label>
                            <el-input  class="add_look" v-model="formDalog.address" size="small"></el-input>
                         </div>  

                        <!-- <div class="look_margin" >
                          <label> &nbsp;&nbsp;&nbsp;录入人:</label>
                              <el-input  class="ingred_sel" v-model="formDalog.loguser" size="small"></el-input>
                          <label> &nbsp;&nbsp;录入时间:</label>
                            <el-input  class="look_width" v-model="formDalog.created_at" size="small"></el-input>
                       </div> 
                       <div class="look_margin" >
                          <label> &nbsp;&nbsp;&nbsp;审核人:</label>
                              <el-input  class="ingred_sel" v-model="formDalog.supervisor" size="small"></el-input>
                          <label> &nbsp;&nbsp;审核时间:</label>
                            <el-input  class="look_width" v-model="formDalog.verified_at" size="small"></el-input>
                       </div>  -->
                       <div class="look_margin" >
                          <label>默认折扣:</label>
                              <el-input  class="ingred_sel" v-model="formDalog.discount_default" size="small"></el-input>
                         <label> &nbsp;&nbsp;&nbsp;实际折扣:</label>
                              <el-input  class="ingred_sel" v-model="formDalog.policy_discount" size="small"></el-input>
                       </div> 
                       <div class="look_margin">
                         <h3>&nbsp; 退货率</h3>
                         <div class="look_margin" >
                            <label>&nbsp;&nbsp;第一季度:</label>
                              <el-input  class="look_tab"  v-model="formDalog.first_rate" size="small" ></el-input>
                              <el-date-picker
                               
                                v-model="formDalog.first_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                :start-placeholder="formDalog.spring_start"
                                :end-placeholder="formDalog.spring_end"
                                >
                              </el-date-picker>
                              </div> 
                            <label>&nbsp;&nbsp;第二季度:</label>
                              <el-input  class="look_tab" v-model="formDalog.second_rate" size="small"></el-input>
                              <el-date-picker
                                v-model="formDalog.second_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                :start-placeholder="formDalog.summer_start"
                                :end-placeholder="formDalog.summer_end"
                               
                               >
                              </el-date-picker>
                             
                              </div> 
                       <div class="look_margin">
                             <label>&nbsp;&nbsp;第三季度:</label>
                                  <el-input  class="look_tab" v-model="formDalog.third_rate"  size="small" ></el-input>
                               <el-date-picker
                                v-model="formDalog.third_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                :start-placeholder="formDalog.fall_start"
                                :end-placeholder="formDalog.fall_end"
                               
                               >
                              </el-date-picker>
                             
                              </div>     
                              <div class="look_margin">
                              <label>&nbsp;&nbsp;第四季度:</label>
                                <el-input  class="look_tab"  v-model="formDalog.fourth_rate" size="small"></el-input>
                                <el-date-picker
                                  v-model="formDalog.fourth_daterange"
                                  value-format="yyyy-MM-dd"
                                  type="daterange"
                                  size="small"
                                  :start-placeholder="formDalog.winter_start"
                                  :end-placeholder="formDalog.winter_end"
                                 
                                  >
                                </el-date-picker>

                              </div> 
                       <div class="look_margin">
                             <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;全年:</label>
                                  <el-input  class="look_tab" v-model="formDalog.year_rate"  size="small" ></el-input> 
                           <el-date-picker
                                v-model="formDalog.year_daterange"
                                value-format="yyyy-MM-dd"
                                type="daterange"
                                size="small"
                                :start-placeholder="formDalog.year_start"
                                :end-placeholder="formDalog.year_end"
                               
                                >
                              </el-date-picker>
                           </div>
                            
                          <el-form-item>
                            <el-button type="primary" @click="UpdataSubmit">确认修改</el-button>
                            <el-button>取消</el-button>
                          </el-form-item>
                        </div>
                        
                     </el-form>
                  </el-dialog>



           </div>         
  </div>
 
  <script>
      const App=new Vue({
        el: '#app',
        data() {
          return {
            aelect_pid:'',
            aelect_type:'',
            pleader:'',
            options: [],
            selectedOptions:[],
            dialogVisible: false,//查看对话框
            UpdataForm:false,//修改对话框
            title:'',//使用与停用
            changboxVal:[],//全选获得id
            tableData: [],//表单
            change:1,//分页 默认为1
            total:1,//分页总数
            checkbox:'',//表单使用跟停用点击的checkbox的id
            name:'',//查询点击名称
            tel:'',//查询点击手机号
            pidx:'',//查询点击所属机构
            ids:[],//表单反审点击的checkbox
            type:[],//table里下拉
            status:[],//table里下拉
            temp:true,//使用停用的开关
            state:'',//所属机构下拉
            resta:[],//表格里的状态
            textVal:'',//这个是机构输入的值
            kwVal:'',//这个是机构返回的值
            restaurants: [],
            data_x:[],
            itemVal:'',
                 formDalog: {
                    id:'',//
                    parent: '',//所属机构
                    name: '',//名称
                    type: '',//类型
                    tel: '',//手机号
                    status:'',//当前状态
                  //  area: '',//省市区
                    area_bh:'',//
                    address: '',//详细地址
                    loguser: '',//录入人
                    created_at: '',//录入时间
                    supervisor: '',//审核人
                    verified_at: '',//审核时间
                    discount_default: '',//默认折扣
                    policy_discount: '',//实际折扣
                    first_rate: '',//第一季度
                    second_rate: '',//第二季度
                    third_rate: '',//第三季度
                    fourth_rate: '',//第四季度
                    year_rate: '',//全年
                   // spring_start:'',//第一季度时间
                    // summer_start:'',//第二季度时间
                    // fall_start:'',//第三季度时间
                    // winter_start:'',//第四季度时间
                    // year_start:'',//全年季度时间
                     policy_type:'1',
                    // spring_end:'',//结束第一季度时间
                    // summer_end:'',//结束第二季度时间
                    // fall_end:'',//结束第三季度时间
                    // winter_end:'',//结束第四季度时间
                    // year_end:'',//结束全年季度时间
                    first_daterange:[],//
                    second_daterange:[],//
                    third_daterange:[],//
                    fourth_daterange:[],//
                    year_daterange:[],
                    
                  },
                  area: [],//省市区
                 area_bha:"",//

          }
        },
        methods: {
           //多选框获得id
           handleSelectionChange(val){
            this.checkbox=[]
            this.changboxVal=[]
            this.resta=[]
           // console.log( 111,val)
                  for(var e in val){
                   // this.checkbox=val[e].id//使用停用
                    this.changboxVal.push(val[e].id)//审核与反审
                    this.resta.push(val[e].status)//表里的状态
                  }
                console.log( 111,this.checkbox)
                console.log( 111,this.changboxVal)
                console.log( 111,this.resta)
                },
          //修改的三级联动
          handleChange(value) {
            const that=this;
                $.ajax({
                  type:'get',
                  url:'/clients/address'
                }).then(function(response){
                  let data=response
                  const options = [];
                  for (let item in data) {

                    let province = {
                            value: data[item].value,
                            label: data[item].label,
                            children: []
                        };
                        for (let city in data[item].children) {
                          let counties=[];
                          for (let county in data[item].children[city].children) {
                                let cityno=data[item].children[city].children[county];
                                counties.push({value:cityno.value,label:cityno.label});
                            }
                            province.children.push({
                                value: data[item].children[city].value,
                                label: data[item].children[city].label,
                                children:counties
                            });
                        }
                            options.push(province)
                      }
                      that.$data.options=options;
                    })
               
          },
          //修改的提交
          UpdataSubmit() {
             let that=this
             let arr=that.area
           
                  if(arr.length == 0){
                  
                      that.formDalog.area_bh=that.area_bha
              
                   $.ajax({
                      type:"put",
                      url:`/clients/update/${this.formDalog.id}`,
                      data:this.formDalog
                    }).then(function(res){
                       
                       that.setGain();  
                       that.UpdataForm=false
                   })
                  }else{
                    
                    that.formDalog.area_bh=arr[2]
                  
                          $.ajax({
                            type:"put",
                            url:`/clients/update/${this.formDalog.id}`,
                            data:this.formDalog
                          }).then(function(res){
                           
                             that.setGain();  
                             that.UpdataForm=false
                        })
                  }
               
          },  
          //查看对话框
          handleClose(done) {
            
                  this.dialogVisible=false
                  this.UpdataForm=false
            },
          //机构的查询
      //     querySearch(queryString, cb) {
      //         var restaurants = this.restaurants;
      //         var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
      //         // 调用 callback 返回建议列表的数据
      //         cb(results);
      //         this.textVal=queryString
      //        // console.log(this.textVal)
      //        this.Datapost();
      //       },
      //       createFilter(queryString) {
      //         return (restaurant) => {
      //           return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
      //         };
      //       },

      // loadAll(content) {
      //   // let arr=content;
      //   // console.log(arr)
      // return content
      // },

      //机构下拉框选好之后
      handleSelect(item){
       this.itemVal=item
      },
      //新增跳转
      added(){
        window.location.href = "/clients/create";
      },
         // 审核
         audit(){
          let self = this
              if(this.changboxVal==''){
                    this.$notify.error({
                        title: '提示',
                        message: '请选择需要审核的项',
                    });
                    return false;
                }
                if(this.changboxVal.length==1){ 
                    if(this.resta==1 || this.resta==11){
                      $.ajax({
                          type:'post',
                          url:'/clients/verify',
                          data:{
                            ids:this.changboxVal
                          },
                          success:function(res){
                            self.setGain();
                            self.$notify.success({
                                  title: '提示',
                                  message: '审核提交成功',
                              });
                            }
                          })
                    }else{
                      this.$notify({
                          title: '警告',
                          message: '此项已审核',
                          type: 'warning'
                            });
                    }

                }else{
                  for( var e in this.resta){
                   // console.log(this.resta[e])
                      if(this.resta[e]==2 || this.resta[e]==12){
                        this.$notify({
                                title: '警告',
                                message: '你选的项中有已审核的项 已审核的项不能再审核',
                                type: 'warning'
                              }); 
                      }else{
                        $.ajax({
                          type:'post',
                          url:'/clients/verify',
                          data:{
                            ids:this.changboxVal
                          },
                          success:function(res){
                            self.setGain();
                            self.$notify.success({
                                  title: '提示',
                                  message: '审核提交成功',
                              });
                            }
                          })
                      }
                      break;
                  }
                }
          

         },
         //反审
         reverify(){
          let self = this
              if(this.changboxVal==''){
                    this.$notify.error({
                        title: '提示',
                        message: '请选择需要反审的项',
                    });
                    return false;
                }
                if(this.changboxVal.length==1){ 
                    if(this.resta==2 || this.resta==12){
                      $.ajax({
                          type:'post',
                          url:'/clients/verify',
                          data:{
                            ids:this.changboxVal
                          },
                          success:function(res){
                            self.setGain();
                            self.$notify.success({
                                  title: '提示',
                                  message: '反审提交成功',
                              });
                            }
                          })
                    }else{
                      this.$notify({
                          title: '警告',
                          message: '此项未审核',
                          type: 'warning'
                            });
                    }

                }else{
                  for( var e in this.resta){
                   // console.log(this.resta[e])
                      if(this.resta[e]==1 || this.resta[e]==11){
                        this.$notify({
                                title: '警告',
                                message: '你选的项中有未审核的项 未审核的项不能反审',
                                type: 'warning'
                              }); 
                      }else{
                        $.ajax({
                          type:'post',
                          url:'/clients/verify',
                          data:{
                            ids:this.changboxVal
                          },
                          success:function(res){
                            self.setGain();
                            self.$notify.success({
                                  title: '提示',
                                  message: '反审提交成功',
                              });
                            }
                          })
                      }
                      break;
                  }
                }
          
         },
         //导出
         expost(){
            if(this.changboxVal!=''){
             
            }else{
              this.$notify.error({
                    title: '提示',
                    message: '请选择需要导出的项',
                });
            }
         },
         //使用跟停用
        deleteRow(e){
          if(this.changboxVal!=''){  
              this.$confirm('你确定对这一项进行操作吗?', '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(() => {
                        this.temp=!this.temp
                        if(this.temp==true){
                          e.target.text="使用"
                        this.Activepost();
                        this.setGain();  
                        
                        that.changboxVal =''  
                      
                        }else{
                          e.target.text="停用"
                          this.Activepost();
                          this.setGain(); 
                          this.changboxVal ='' 
                        
                        }
                        this.$notify.success({
                            title: '提示',
                            message: '操作成功',
                        });
                        this.setGain();    
                    }).catch(() => {
                      this.$notify.success({
                            title: '提示',
                            message: '取消操作',
                        });        
                    });     
              }else{       
                this.$notify.error({
                    title: '提示',
                    message: '请选择需要操作的项',
                });
                }  
           },

         check(selection, row){//多选框 
               this.changbox=[]
             console.log(row.id)
                    this.checkbox=row.id
                    this.ids.push(row.id)
                  //  this.resta.push(row.status)
             },
         //点击查询
         onGet(){
           var that=this
           this.name=$('#namex').val();
           this.tel=$('#telx').val();
              this.setGain();
          },
          //列表里的下拉菜单
          filterTag(value) {  
            console.log(value)   
               this.type=value.type
               this.status=value.type
               this.setGain();
            },
          handleCurrentChange(val){
              this.change=val
               this.setGain();    
          },
          //获取table数据
         setGain(){
        
           let i=0
              let self = this
              let skip=self.change
              let parents = []
              var pat=[]
            $.ajax({
              type:'get',
              url:'/clients/indexapi',
              dataType:'json',
              data:{
                current_page:this.change,
                name:this.name,
                tel:this.tel,
                type:this.type,
                status:this.status,
                'parent.name':this.pidx
                
              },
              success:function(res){
              console.log(res)
                self.data_x=res.content.data
                 res.content.current_page =skip  
                 self.total=res.content.total
                 //self.tableData=res.content.data;
               //  self.checkbox =''  
                      var opt=[];
                      let i = -10;
                      for(var e of res.content.data){
                        i++;
                        opt.push({
                          'loop':i+(10*self.change),
                          'jigou':e.parent.comment,
                          'type':e.type,
                          'name':e.name,
                          'tel':e.tel,
                          'supervisor':e.supervisor,
                          'verified_at':e.verified_at,
                          'admin_a':e.log_user.admin_name,
                          'created_at':e.created_at,
                          'status':e.status,
                          'id':e.id

                        })
                      
                  }
                 
                  self.tableData=opt;
                
                
              }
            })
          
          },
      
           Activepost(){//使用跟停用按钮用的
            let self = this
                  $.ajax({
                        type:'post',
                        url:'/clients/active',
                        dataType:'json',
                        data:{
                          id:this.checkbox
                        },
                        success:function(res){
                          self.setGain();
                        
                        }
                      })
               },
               //查看
               lookDis(scope){
                  let that=this
                //this.dialogVisible=true
                
                $.ajax({
                          type:'get',
                          url:`/clients/show/${scope.row.id}`,
                          dataType:'json',
                           success:function(res){
                           //console.log(res.content.policies)
                           //that.area_bha=res.content.area_bh
                           res.content.policies.map(function(e){
                                   var  one=e.spring_rate
                                   var  two=e.summer_rate
                                   var  three=e.fall_rate
                                   var  four=e.winter_rate
                                   var  five=e.year_rate
                                   var  policy_discount=e.policy_discount
                                   var  spring_start=e.spring_start
                                   var  summer_start=e.summer_start
                                   var  fall_start=e.fall_start
                                   var  winter_start=e.winter_start
                                   var  year_start=e.year_start
                                   var  spring_end=e.spring_end
                                   var  summer_end=e.summer_end
                                   var  fall_end=e.fall_end
                                   var  winter_end=e.winter_end
                                   var  year_end=e.year_end
                                 
                                   that.dialogVisible=true
                                    that.aelect_pid=res.content.pid
                                    that.aelect_type=res.content.type
                                    that.formDalog.id=scope.row.id
                                    that.formDalog.name=res.content.name
                                    that.formDalog.tel=res.content.tel
                                    that.formDalog.status=res.content.status
                                    that.formDalog.area=res.content.trueProvince+"/"+res.content.trueCity+'/'+res.content.trueDistrict
                                    that.formDalog.address=res.content.address
                                    that.formDalog.loguser=res.content.loguser.admin_name
                                    that.formDalog.created_at=res.content.created_at
                                    that.formDalog.supervisor=res.content.supervisor
                                    that.formDalog.verified_at=res.content.verified_at
                                    that.formDalog.discount_default=res.content.discount_default
                                    that.formDalog.policy_discount=policy_discount
                                    that.formDalog.pid=res.content.pid
                                    that.formDalog.first_rate=one
                                    that.formDalog.second_rate=two
                                    that.formDalog.third_rate=three
                                    that.formDalog.fourth_rate=four
                                    that.formDalog.year_rate=five
                                    // that.formDalog.spring_start=spring_start
                                    // that.formDalog.summer_start=summer_start
                                    // that.formDalog.fall_start=fall_start
                                    // that.formDalog.winter_start=winter_start
                                    // that.formDalog.year_start=year_start
                                    // that.formDalog.spring_end=spring_end
                                    // that.formDalog.summer_end=summer_end
                                    // that.formDalog.fall_end=fall_end
                                    // that.formDalog.winter_end=winter_end
                                    // that.formDalog.year_end=year_end
                                    that.pleader=that.formDalog.area
                                    that.formDalog.first_daterange.push(spring_start,spring_end)
                                    that.formDalog.second_daterange.push(summer_start,summer_end)
                                    that.formDalog.third_daterange.push(fall_start,fall_end)
                                    that.formDalog.fourth_daterange.push(winter_start,winter_end)
                                    that.formDalog.year_daterange.push(year_start,year_end)

                                   that.formDalog.spring_start= that.formDalog.first_daterange[0]
                                   that.formDalog.spring_end=that.formDalog.first_daterange[1]

                                   that.formDalog.summer_start= that.formDalog.second_daterange[0]
                                   that.formDalog.summer_end=that.formDalog.second_daterange[1]
                                   that.formDalog.fall_start= that.formDalog.third_daterange[0]
                                   that.formDalog.fall_end=that.formDalog.third_daterange[1]
                                   that.formDalog.winter_start= that.formDalog.fourth_daterange[0]
                                   that.formDalog.winter_end=that.formDalog.fourth_daterange[1]
                                   that.formDalog.year_start= that.formDalog.year_daterange[0]
                                   that.formDalog.year_end=that.formDalog.year_daterange[1]
                              
                              })
                          
                          }
                        })
               },
               //点击修改
               updataDis(scope){
                    let that=this
                   
                 if(scope.row.status===1|| scope.row.status===11){
               
                  $.ajax({
                          type:'get',
                          url:`/clients/edit/${scope.row.id}`,
                          dataType:'json',
                          success:function(res){
                           that.area_bha=res.content.area_bh
                           res.content.policies.map(function(e){
                                   var  one=e.spring_rate
                                   var  two=e.summer_rate
                                   var  three=e.fall_rate
                                   var  four=e.winter_rate
                                   var  five=e.year_rate
                                   var  policy_discount=e.policy_discount
                                   var  spring_start=e.spring_start
                                   var  summer_start=e.summer_start
                                   var  fall_start=e.fall_start
                                   var  winter_start=e.winter_start
                                   var  year_start=e.year_start
                                   var  spring_end=e.spring_end
                                   var  summer_end=e.summer_end
                                   var  fall_end=e.fall_end
                                   var  winter_end=e.winter_end
                                   var  year_end=e.year_end
                                 
                                    that.UpdataForm=true
                                    that.aelect_pid=res.content.pid
                                    that.aelect_type=res.content.type
                                    that.formDalog.id=scope.row.id
                                    that.formDalog.name=res.content.name
                                    that.formDalog.tel=res.content.tel
                                    that.formDalog.status=res.content.status
                                    that.formDalog.area=res.content.trueProvince+"/"+res.content.trueCity+'/'+res.content.trueDistrict
                                    that.formDalog.address=res.content.address
                                    that.formDalog.loguser=res.content.loguser.admin_name
                                    that.formDalog.created_at=res.content.created_at
                                    that.formDalog.supervisor=res.content.supervisor
                                    that.formDalog.verified_at=res.content.verified_at
                                    that.formDalog.discount_default=res.content.discount_default
                                    that.formDalog.policy_discount=policy_discount
                                    that.formDalog.pid=res.content.pid
                                    that.formDalog.first_rate=one
                                    that.formDalog.second_rate=two
                                    that.formDalog.third_rate=three
                                    that.formDalog.fourth_rate=four
                                    that.formDalog.year_rate=five
                                  
                                    that.pleader=that.formDalog.area
                                    that.formDalog.first_daterange.push(spring_start,spring_end)
                                    that.formDalog.second_daterange.push(summer_start,summer_end)
                                    that.formDalog.third_daterange.push(fall_start,fall_end)
                                    that.formDalog.fourth_daterange.push(winter_start,winter_end)
                                    that.formDalog.year_daterange.push(year_start,year_end)

                                   that.formDalog.spring_start= that.formDalog.first_daterange[0]
                                   that.formDalog.spring_end=that.formDalog.first_daterange[1]

                                   that.formDalog.summer_start= that.formDalog.second_daterange[0]
                                   that.formDalog.summer_end=that.formDalog.second_daterange[1]
                                   that.formDalog.fall_start= that.formDalog.third_daterange[0]
                                   that.formDalog.fall_end=that.formDalog.third_daterange[1]
                                   that.formDalog.winter_start= that.formDalog.fourth_daterange[0]
                                   that.formDalog.winter_end=that.formDalog.fourth_daterange[1]
                                   that.formDalog.year_start= that.formDalog.year_daterange[0]
                                   that.formDalog.year_end=that.formDalog.year_daterange[1]

                              })
                          
                          }
                        })
                    }else{
                        this.$notify.success({
                            title: '提示',
                            message: '已审核的内容不能再进行修改操作',
                        });
                    }
               }   
          },
          mounted() {
               this.setGain();
             
          },
      })
  </script>
@endsection